-- =====================================================================
-- 
--   File:      4.sql
--   Summary:   This script, which is run on the server instance that will contain the mirror database, creates 
--              the mirror database from the backup created in the previous script.
--  
--   Date:      May 8, 2006
-- 
-- ---------------------------------------------------------------------
-- 
--   This file is part of the Microsoft SQL Server Code Samples.
--   Copyright (C) Microsoft Corporation.  All rights reserved.
-- 
-- This source code is intended only as a supplement to Microsoft
-- Development Tools and/or on-line documentation.  See these other
-- materials for detailed information regarding Microsoft code samples.
-- 
-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF 
-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
-- PARTICULAR PURPOSE.
-- 
-- ===================================================================== 

-- Step 4 (on Mirror)
-- Create the mirror database
RESTORE DATABASE HADB
FROM DISK='C:\HADB.bak'
WITH NORECOVERY, FILE=1,
MOVE 'HADB' TO 'C:\HADB.mdf',
MOVE 'HADB_log' TO 'C:\HADB_log.ldf'
;

RESTORE LOG HADB
FROM DISK='C:\HADB.bak'
WITH NORECOVERY, FILE=2,
MOVE 'HADB' TO 'C:\HADB.mdf',
MOVE 'HADB_log' TO 'C:\HADB_log.ldf'
;